using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Sample.Messages;
using SimpleServiceBus.Bus.MessageManagement.MessageHandling;

namespace SampleConsumer.Handlers {

    public class PingHandler: IMessageHandler<PingPong> {

        public void Handle(PingPong message, SimpleServiceBus.Bus.Pipeline.IMessageContext context) {
            Logger.Log("{0} Ping", message.CurrentIteration);
            message.Increment();
            if(!message.IsDone)
                context.Endpoint.MessageBus.Send(message);
            else
                Logger.Log("Ping/Pong is done.");
        }
    }
}

